package org.mybatis.generator.codegen.mybatis3.model;

import org.mybatis.generator.api.FullyQualifiedTable;
import org.mybatis.generator.api.IntrospectedColumn;
import org.mybatis.generator.api.dom.java.CompilationUnit;
import org.mybatis.generator.api.dom.java.FullyQualifiedJavaType;
import org.mybatis.generator.api.dom.java.JavaVisibility;
import org.mybatis.generator.api.dom.java.TopLevelEnumeration;
import org.mybatis.generator.codegen.AbstractJavaGenerator;

import java.util.ArrayList;
import java.util.List;

import static org.mybatis.generator.internal.util.messages.Messages.getString;

/**
 * @Description: Entity类枚举类型属性生成Generator
 * @Author xuanfei.Chen
 * @Time 2019/12/9 10:42
 */
public class BaseRecodeInnerEnumGenerator extends AbstractJavaGenerator {

    private FullyQualifiedJavaType enumJavaType;

    private List<String> enumValues;

    public BaseRecodeInnerEnumGenerator(FullyQualifiedJavaType enumJavaType, List<String> enumValues) {
        this.enumJavaType = enumJavaType;
        this.enumValues = enumValues;
    }

    public BaseRecodeInnerEnumGenerator() {
        super();
    }

    @Override
    public List<CompilationUnit> getCompilationUnits() {
        TopLevelEnumeration topLevelEnumeration = new TopLevelEnumeration(enumJavaType, enumValues);
        topLevelEnumeration.setVisibility(JavaVisibility.PUBLIC);
        List<CompilationUnit> answer = new ArrayList<CompilationUnit>();
        answer.add(topLevelEnumeration);
        return answer;
    }
}
